import request from "@/utils/request";
import qs from "qs";
// 站点列表
export function listSite() {
  return request({
    url: "/site/list",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "get",
  });
}

// 新建站点
export function addSite(data) {
  return request({
    url: "/site/add",
    method: "post",
    data: data,
  });
}

// 更新站点
export function editsite(data) {
  return request({
    url: "/site/edit",
    method: "post",
    data: data,
  });
}

//读取站点详细信息
export function siteDetail(siteId) {
  return request({
    url: `/site/${siteId}`,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "GET",
  });
}

// 删除站点
export function siteRemove(data) {
  return request({
    url: "/site/remove",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "POST",
    data: qs.stringify(data),
  });
}

// 读取别名是否存在
export function aliasValidate(data) {
  return request({
    url: "/site/validateAlias",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "GET",
    params: data,
  });
}
//网站发布
export function publicSite(data) {
  return request({
    url: "/release/publicize/site",
    headers: {
      "content-type": "application/x-www-form-urlencoded",
      showLoading: false,
    },
    method: "post",
    timeout: 0,
    data: qs.stringify(data),
  });
}
